﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="headers.ascx.cs" Inherits="Web.HX.AboutControl.headers" %>
 <!--导航-->
  <script src="js/index.js" type="text/javascript"></script><!--滚动监听--> 
    <div class="m-nav">
        <nav class="m-nav-header">
            <div class="m-nav-logo"><a href="http://about.91job.com/" target="_blank"><img class="navbar-brand-image" src="/images/chxrclogo.png" /></a></div>
            <div class="navlist">
                <ul>
                    <li><a class="nav-item" href="ContactUs.html">联系我们</a></li>
                    <li><a class="nav-item" href="JoinUs.html">加入恒信</a></li>
                    <li><a class="nav-item" href="newslist.html">企业动态</a></li>
                    <li><a class="nav-item" href="About.html">关于我们</a></li>
                    <li class="product-title">
                    <a class="nav-item" href="">产品服务</a>
                    <div class="tip-box ">
                        <div class="tip">
                        <a class="nav-tip-item" href="SolutionOnline.html">网络招聘</a>
                        <a class="nav-tip-item" href="SolutionCenter.html">招聘中心</a>
                        <a class="nav-tip-item" href="Solutiondispatch.html">劳务派遣</a>
                        <a class="nav-tip-item" href="SolutionOutsourcing.html">劳务外包</a>
                        <a class="nav-tip-item" href="SolutionTrusteeship.html">劳动托管关系</a>
                        <a class="nav-tip-item" href="SolutionConsulting.html">人力资源咨询</a>
                        <a class="nav-tip-item" href="SolutionTest.html">人资考试</a>
                        <a class="nav-tip-item" href="SolutionTaxation.html">财税外包</a>
                        </div>
                    </div>
                    
                    </li>
                    <li><a class="nav-item active" href="/">首页</a></li>
                </ul>
            </div>
            <%--<div class="m-nav-phone">
                <ul>
                    <li><img src="/images/phone-ico.png" /></li>
                    <li>
                        <h1>共享共担，平凡人做非凡事</h1>
                        <p><span>咨询：</span>0579-85129191</p>
                    </li>
                </ul>
            </div>--%>
            <div class="clear"></div>
        </nav>
    </div>
    <div class="clear"></div>
    <script>
      // 页面加载时根据当前URL设置激活状态
    document.addEventListener('DOMContentLoaded', function() {
        const navItems = document.querySelectorAll('.nav-item');
       const currentUrl = window.location.pathname.toLowerCase();
    const currentPage = currentUrl.split('/').pop() || 'index.html';
    console.log('currentPage',currentPage)

        navItems.forEach(item => {
            // 移除所有激活状态
            item.classList.remove('active');
            
             // 获取链接的目标页面
        const itemHref = item.getAttribute('href').toLowerCase();
        const itemPage = itemHref.split('/').pop();
        console.log('获取链接的目标页面',currentPage,itemPage)
           if (currentPage === itemPage||
            (currentPage.includes('about') && itemPage.includes('about')) ||
            (currentPage.includes('joinus') && itemPage.includes('joinus')) ||
            (currentPage.includes('contactus') && itemPage.includes('contactus'))) {
            item.classList.add('active');
        }
        });

        // 点击事件处理
        // 点击事件处理
    navItems.forEach(item => {
        item.addEventListener('click', () => {
            navItems.forEach(nav => nav.classList.remove('active'));
            item.classList.add('active');
        });
    });
    });
</script>
